<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/layer.css"/>
		<script src="../../js/layer.js" type="text/javascript" charset="utf-8"></script>
		<title></title>
	</head>

	<body>
		<input id="file" type="file" onchange="verify(this.value)" />
		<img id="imgdome" src="../../img/home/01.jpg"/>
		<!--<img src="http://172.16.24.168:8091/WebDemoTest/drugWorkOrderImages/28a4cbd7-03e4-4f91-b093-0e7cb34239d1.jpg"/>-->
		<script src="../../js/jquary.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			function verify(val) {
				var file = document.getElementById("file").files[0];
				var imgtype = file.type;
//				shanchuan(file)
//				console.log(file)
				console.log(JSON.stringify(file))
				console.log("图片格式:" + imgtype)
				if(imgtype == "image/jpeg" || imgtype == "image/png") {
					var reader = new FileReader();
					reader.onload = function(e) {
						document.getElementById('imgdome').setAttribute('src', e.target.result);
						shanchuan(e.target.result)
//						console.log(e.target.result)
//						console.log(e.target.result.match(/base64,(\S*)/)[1])
					};
					reader.readAsDataURL(file);
				} else {
					alert("请上传jpg或PNG格式的图片")
				}
			}
			//
			
			function shanchuan(filer){
				ajaxPost(
					'http://172.16.24.168:8091/WebDemoTest/rest/medical/assess/updateDrugOrderStatus', 
					{
						"orderId":"20180126001",
						"type":"2",
						"file":"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3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REwCjoBf408RUkCAYBDGwAiZB1C65afPMBybAOei3KZ5Kfo45pwmfUwM1YJ+/PN/4v2TsCHMFtAaawB7nOVuSXLvMbWtAXG6BSiP7qmTuQDoDhWANlBvuSXKvs9YvA+OgwXBf9az1zYC8dGHDO4UTU5EwMAbyPDSQx5qfBoq5yWj1DmZBC8cW8/Msn2nVI2NlJ+xwsMlcgy5uuck6IEsgAqqUm1WH/AMhB788VfFknfK8eFPmDJl8KzWa+6N4QmdgXrsiTK4AjZYdzK82tkYMlCiDjx0YOFHGlZguLjOVxMCDMrbJgYE6ZdyDGLhUBjvZK7Sxl2LAUgYPKs+KesZqZImBbWVwAXs9uz5BDG4yVqNtkwNiygGywx2CGdDM3czPz/LdkXIXFD1LbdmKpS1eBX0O2qxhkomkaX1MLENpPuMenoZxNqtfx7G0ztMeGpDpukjVEVkeFLdSdUSiF9ANbl0sfssaz+m6YpmKdnDjQvEb5o7+dS+QQ6c1y9NhMeex9mYU5T1vKsPVEWeOYLo7ot1p+MqrWS1YSJ43heR9WuTYUeb69+1YlssAW+muH9fzMsbc/bieR7TX8w8BBgD7S2/zG8ittQAAAABJRU5ErkJggg=="
					},
					function(data) {
						console.log(data)
//						window.location.reload(true);
//						alert("订单取消成功")
				//		main.response=data.response
					},
					function(){
						console.log("上传图片失败")
					}
				)
			}
			
			
		</script>
	</body>

</html>